<%@ page contentType="text/html;charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>黑龙江电信需求管理平台</title>
<link rel="stylesheet" href="<%=request.getContextPath()%>/js/layui-v1.0.9_rls/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/global.css" type="text/css"/>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/index.css" type="text/css"/>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/menu.css" type="text/css"/>


 <!--[if lt IE 7]>       
 <script src="<%=request.getContextPath()%>/js/fixPNG.js"></script>         
 <script>
 DD_belatedPNG.fix('img,span');
 </script>     
<![endif]-->
<link href="<%=request.getContextPath()%>/css/lanrenzhijia.css" rel="stylesheet" type="text/css" />
<style type="text/css">
	body{margin:0; padding:0;}
	.logoRigth_1{
		position: absolute;
		right: 15px ;
	}
	.logoRigth_2{
		position: absolute;
		right: 70px ;
	}
</style>
</head>

<body style="overflow: hidden;" scroll="no">
<!-- header -->
<div class="header" region="north" border="true" >
<div class="logo fleft"><img src="<%=request.getContextPath()%>/images/logo.png" width="344" height="49" /></div>
<div class="header_right">
	<ul>
	 <li style="color:white;">你好,<%=session.getAttribute("loginName") %>!</li>
	  <li class="logoRigth_2"><a href="<%=request.getContextPath()%>/rms/index" title="首页" id="home"></a></li>
	  <li class="logoRigth_1"><a href="javascript:void(0)" title="注销登录" id="logout" onclick="logout()"></a></li>
	</ul>
</div>
</div>
<div class="layui-body" style="bottom: 0;border-left: solid 2px #1AA094;background-color: #0059a5;" id="admin-body">

<div class="layui-tab admin-nav-card layui-tab-brief " lay-filter="admin-tab" lay-allowClose="true">
	
	<ul class="layui-tab-title" id="tab-title" >
		<li class=" activeBackGround">
			<cite >桌面</cite><i class="fa fa-dashboard " aria-hidden="true" id="leftTextI"></i>
		</li>
	</ul>
	<div class="layui-tab-content " style="height: 100%; padding: 0;">
		<div class="layui-tab-item layui-show" id="mainBody">
			<!-- content -->
			<div  style="position:relative;" onload="changeFrameHeight()" id="iframepage">
			     
			   <div id="frame">
			   <div id="scroller">
			    <div id="content">
			       <div class="section" id="pane-0">
			        <div class="page1">
			           <div class="content">
			            <div class="first_screen" id="first_screen">
			               
			               <div class="time"> <span id="h1"></span> <span id="h2"></span><strong>:</strong> <span id="m1"></span> <span id="m2"></span><strong>:</strong> <span id="s1"></span> <span id="s2"></span> </div>
			               <div class="date" id="currentime"></div>
			               <div class="welcome_wz" id="welcome_wz"><img src="<%=request.getContextPath()%>/images/welcome_wz.png" width="400"  /></div>
			             </div>
			          </div>
			         </div>
			      </div>
			      
			  </div>
			 
			   <div class="clear"></div>
			   <!-- -->
			   <div class="main_desktop" >
			    <ul class="desktop_wrap">
			       <li>
			        <p>发起需求</p>
			        <a href="#" data-url="<%=request.getContextPath()%>/rms/reqCreateInit" title="发起需求" class="clickurl"><img src="<%=request.getContextPath()%>/images/icon_20.png" width="56" height="58" /></a></li>
			       <li>
			        <p>我的需求</p>
			        <a href="#" data-url="<%=request.getContextPath()%>/rms/myReqList" title="我的需求" class="clickurl"><img src="<%=request.getContextPath()%>/images/icon_19.png" width="64" height="57" /></a></li>
			       <li>
			        <p>待办工单</p>
			        <a href="#" data-url="<%=request.getContextPath()%>/rms/woInit"  title="待办工单" class="clickurl"><img src="<%=request.getContextPath()%>/images/icon_1.png" width="64" height="62" /></a></li>
			       <li>
			        <p>需求查询</p>
			        <a href="#" data-url="<%=request.getContextPath()%>/rms/reqList" title="需求查询" class="clickurl"><img src="<%=request.getContextPath()%>/images/icon_9.png" width="60" height="58" /></a></li>
			     </ul>
			  </div>
			 </div>
			 </div>
		</div>
	 </div>
	</div>
</div>
</div>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/layui-v1.0.9_rls/layui/layui.js"></script>

<script src="<%=request.getContextPath()%>/js/time.js" language="javascript"></script>
 <script>
 	function changeFrameHeight(){
    var ifm= document.getElementById("iframepage");
    var aframe= document.getElementById("frame");
    
    var tabTitle=$("#tab-title").height();
    ifm.height=document.documentElement.clientHeight-tabTitle-16-66;
    ifm.width=document.documentElement.clientWidth;
	}
 	$(function(){
 		setHeigth() ;
 		
	});
 function setHeigth(){
 	var tabTitle=$("#tab-title").height();
 		 var height=document.documentElement.clientHeight-tabTitle-16-66;
 	$("#first_screen").height(height*0.5);
 	 if(height*0.5<370){
 	 	$("#welcome_wz").hide();
 	 }else{
 	 	$("#welcome_wz").show();
 	 }
   	 $("#frame").attr("style","height:"+height+"px !important;");
   	 $(".autoIframe").attr("style","height:"+(height)+"px !important;");
 }

window.onresize=function(){  
	setHeigth() ;
     changeFrameHeight();  
} 

//判断选项卡是否存在
function getIndex(title){
	var tabIndex =-1;
		$("#tab-title").find('li').each(function(i, e) {
			var $cite = $(this).children('cite');
			
			if($cite.text() === title) {
				tabIndex = i;
			};
		});
	return tabIndex;
}

//选项卡对象
var tabEle;

//获取选项卡id
function getTabId(title){
	var tabId =-1;
	$("#tab-title").find('li').each(function(i, e) {
			var $cite = $(this).children('cite');
			if($cite.text() === title) {
				tabId = $(this).attr('lay-id');
			};
		});
	return tabId;
}


//关闭tab页
function _closeTab(title){
		var id = getTabId(title);
		tabEle.tabDelete("admin-tab",id);
}

//打开tab页
function _addTab(title,url){

		var index = getIndex(title);
  		if(index!=-1){
  			var layId = getTabId(title);
  			//切换到当前打开的选项卡
			tabEle.tabChange('admin-tab',layId );
  			return false;
  		}
  	//新增一个Tab项
      tabEle.tabAdd('admin-tab', {
        title: '<cite>'+title+'</cite>'//用于演示
        ,content: "<iframe src='"+url+"' class='autoIframe' width='100%' frameborder ='0' ></iframe>" 
        ,id: new Date().getTime() //实际使用一般是规定好的id，这里以时间戳模拟下
      });
      
      var layId = getTabId(title);
      //切换选项卡
      tabEle.tabChange('admin-tab',layId );
      setHeigth();
}


layui.use('element', function(){
  var $ = layui.jquery;
  tabEle = layui.element(); //Tab的切换功能，切换事件监听等，需要依赖element模块
  
  
 		 //监听选项卡切换事件
		  tabEle.on('tab(admin-tab)', function(data){
			var  li =	$("#tab-title").find( '.layui-this');
			var text = $(li).children('cite').text();
			//桌面不设置样式
			 if(text =='桌面'){
			 	$(li).removeClass('layui-this');
			 }
		});
  
  
  $(".clickurl").on("click",function(data){
  		var title =$(this).attr('title');
  		var url =$(this).attr('data-url');
  		_addTab(title,url);
  });
  //触发事件
  var active = {
    tabAdd: function(){
      //新增一个Tab项
      
      tabEle.tabAdd('admin-tab', {
        title: '新选项'+ (Math.random()*1000|0) //用于演示
        ,content: '内容'+ (Math.random()*1000|0)
        ,id: tabId //实际使用一般是规定好的id，这里以时间戳模拟下
      })
      
    }
    ,tabDelete: function(othis){
      //删除指定Tab项
      tabEle.tabDelete('demo', '44'); //删除：“商品管理”
      
      
      othis.addClass('layui-btn-disabled');
    }
    ,tabChange: function(){
      //切换到指定Tab项
      tabEle.tabChange('demo', '22'); //切换到：用户管理
    }
  };
  
  $('.site-demo-active').on('click', function(){
    var othis = $(this), type = othis.data('type');
    active[type] ? active[type].call(this, othis) : '';
  });
  
  //Hash地址的定位
  var layid = location.hash.replace(/^#test=/, '');
  tabEle.tabChange('test', layid);
  
  tabEle.on('tab(test)', function(elem){
    location.hash = 'test='+ $(this).attr('lay-id');
  });
  
});

//退出系统
function logout(){

	$.post("<%=request.getContextPath()%>/sys/logout",
		{},
		
		function(data){
			var form =  $('<form id="_tempForm"></form>');
			form.attr('action', "<%=request.getContextPath()%>/sys/login");
			form.attr('method', 'post');
			form.appendTo(document.body).submit(); 
	});
}
 </script>
</body>
</html>
